package com.linciping.treeview;

import java.util.List;

public abstract class SampleNode<T> {

    /**
     * 包含所有的子节点
     */
    private int allChildCount;

    private int level;

    private boolean expand = true;

    public abstract List<T> getChildrenList();

    public boolean isMinChildren(int maxLevel) {
        return level>= maxLevel;
    }

    public int getChildCount() {
        if (CheckUtil.isCollectionEmpty(getChildrenList())) {
            return 0;
        }
        return getChildrenList().size();
    }

    public boolean isExpand() {
        return expand;
    }

    public void toggleExpand() {
        this.expand = !this.expand;
    }

    public int getAllChildCount() {
        return allChildCount;
    }

    public void setAllChildCount(int allChildCount) {
        this.allChildCount = allChildCount;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }
}
